#!/bin/bash

echo "#Generating the .ptrace file needed for Hotspot"
echo "#Author: Min Li, Contact: mli46@wisc.edu"
echo -ne "#Generated Date: "
date
echo 

## generating the initial temperature file
if [ "$HSTA_INIT_RUN" == "0" ]
then
## Temp should actually be 300 
HOTSPOT_INIT_FILE=$HSTA_BENCHMARK_DIR\/$HSTA_BENCHMARK".hotspot_init"
awk '{print $1 " 320.0"}' $HSTA_PTRACE_FILE_TEMP > $HOTSPOT_INIT_FILE
fi

awk '{
     if (max_nf < NF)
          max_nf = NF
     max_nr = NR
     for (x = 1; x <= NF; x++)
          vector[x, NR] = $x
}

END {
     for (x = 1; x <= max_nf; x++) {
        for (y = 1; y <= max_nr; y++)         
               printf("%s ", vector[x, y])
          printf("\n")
     }
}' $HSTA_PTRACE_FILE_TEMP > $HSTA_PTRACE_FILE


